package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.ForeignKey;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.GoodsSutrax;

/**
 * QGoodsSutrax is a ORMLite query type for GoodsSutrax
 * @see GoodsSutrax
 */
public class QGoodsSutrax extends QEntityBase<GoodsSutrax> {

    public static final QGoodsSutrax $ = new QGoodsSutrax("GOODS_SUTRAX");

    public final Column goodsId = field("goodsId").columnName("GOODS_ID").varchar(22).notNull().build();

    public final Column sutraxId = field("sutraxId").columnName("SUTRAX_ID").varchar(22).notNull().build();

    public final Column templateId = field("templateId").columnName("TEMPLATE_ID").varchar(22).notNull().build();

    public class Indexs {

        public final Index constraintIndexB = index("CONSTRAINT_INDEX_B").unique().column(goodsId).column(sutraxId).build();

        public final Index constraintIndexBb = index("CONSTRAINT_INDEX_BB").column(goodsId).build();

        public final Index constraintIndexBb9 = index("CONSTRAINT_INDEX_BB9").column(sutraxId).build();

        public final Index primaryKeyB = index("PRIMARY_KEY_B").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public class ForeignKeys {

        public final ForeignKey constraintBb9 = foreignKey(goodsId, "GOODS", "ID");

        public final ForeignKey constraintBb98 = foreignKey(sutraxId, "SUTRAX", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public QGoodsSutrax(String tableName) {
        super(GoodsSutrax.class, tableName);
    }

    @Override
    public GoodsSutrax newInstance() {
        return new GoodsSutrax();
    }

    @Override
    public Object getFieldValue(GoodsSutrax instance, String fieldName) {
        switch (fieldName) {
            case "goodsId":
                return instance.getGoodsId();
            case "sutraxId":
                return instance.getSutraxId();
            case "templateId":
                return instance.getTemplateId();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(GoodsSutrax instance, String fieldName, Object value) {
        switch (fieldName) {
            case "goodsId":
                instance.setGoodsId((java.lang.String) value);
                break;
            case "sutraxId":
                instance.setSutraxId((java.lang.String) value);
                break;
            case "templateId":
                instance.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

